package day6;

import java.util.Scanner;

/**
 * @author oldliu
 * @since 1.0
 */
public class Sum10000 {
    public static void main(String[] args) {
//        double a = 0;
//        for (int i =1;i<=1000;i++){
//            a = a+1.0/(i*i);
//        }
//        System.out.println("和为："+a);
        //现在纸币面额有 1元，2元，5元，10元，20元，50元和100元，输入一个正整数的金额，
        // 输出所有的组成可能，比如输入 3元，则有  3个1元 和  一个2+1个1元两种可能
        Scanner in = new Scanner(System.in);
        System.out.println("input money:");
        int money = in.nextInt();
        int m100, m50, m20, m10, m5, m2, m1;
        for (m100 = 0; m100 <= money / 100; m100++) {
            for (m50 = 0; m50 <= money / 50; m50++) {
                for (m20 = 0; m20 <= money / 20; m20++) {
                    for (m10 = 0; m10 <= money / 10; m10++) {
                        for (m5 = 0; m5 <= money / 5; m5++) {
                            for (m2 = 0; m2 <= money / 2; m2++) {
                                m1 = money - 100 * m100 - 50 * m50 - 20 * m20 - 10 * m10 - 5 * m5 - 2 * m2;
                                if (m1 < 0)
                                    continue;

                                System.out.print("100元" + m100 + "张\t");
                                System.out.print("50元" + m50 + "张\t");
                                System.out.print("20元" + m20 + "张\t");
                                System.out.print("10元" + m10 + "张\t");
                                System.out.print("5元" + m5 + "张\t");
                                System.out.print("2元" + m2 + "张\t");
                                System.out.print("1元" + m1 + "张\t");
                                System.out.println();
                            }
                        }
                    }
                }
            }
        }

    }
}
